package work2;

import java.io.FileOutputStream;
import java.io.IOException;

public class AutoCloseableDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了...");
        try(FileOutputStream fos1=new FileOutputStream("test.txt");
        ){
                fos1.write(2);
            } catch (IOException e) {
                e.printStackTrace();
            }
        System.out.println("程序结束了...");
    }
}
